  import * as globalTypes from '../../../mutation-types'
  import base from '../../../api/config/account/base'

  /**
   * 设置余额预警值
   * @param data {}
   */
  export const updateNotifySet = ({commit, state, rootState, dispatch}, data) => {
    return base.updateNotifySet(data)
      .then(response => {
        return response
      })
      .catch(() => {
        commit(globalTypes.SET_ERROR, 'message.default_tips')
      })
  }
  /**
   * 认证
   * @param data {}
   */
  export const identification = ({commit, state, rootState, dispatch}, data) => {
    return base.identification(data)
      .then(response => {
        return response
      })
      .catch(() => {
        commit(globalTypes.SET_ERROR, 'message.default_tips')
      })
  }

  /**
   * 获取账户信息
   * @param data {}
   */
  export const getAccountInfo = ({commit, state, rootState, dispatch}, data) => {
    return base.getAccountInfo(data)
      .then(response => {
        return response
      })
      .catch(() => {
        commit(globalTypes.SET_ERROR, 'message.default_tips')
      })
  }

  /**
   * 更新账户信息
   * @param data {}
   */
  export const updateAccountInfo = ({commit, state, rootState, dispatch}, data) => {
    return base.updateAccountInfo(data)
      .then(response => {
        return response
      })
      .catch(() => {
        commit(globalTypes.SET_ERROR, 'message.default_tips')
      })
  }
  /**
   * 完成续费
   * @param data {}
   */
  export const finishPay = ({commit, state, rootState, dispatch}, data) => {
    return base.finishPay(data)
      .then(response => {
        return response
      })
      .catch(() => {
        commit(globalTypes.SET_ERROR, 'message.default_tips')
      })
  }
  /**
   * 增加licence
   * @param data {}
   */
  export const addLicence = ({commit, state, rootState, dispatch}, data) => {
    return base.addLicence(data)
      .then(response => {
        return response
      })
      .catch(() => {
        commit(globalTypes.SET_ERROR, 'message.default_tips')
      })
  }
  /**
   * 获取licence列表
   * @param data {}
   */
  export const getAllLicenceList = ({commit, state, rootState, dispatch}, data) => {
    return base.getAllLicenceList(data)
      .then(response => {
        return response
      })
      .catch(() => {
        commit(globalTypes.SET_ERROR, 'message.default_tips')
      })
  }
  /**
   * 获取
   * 获取小陌机器人列表
   * @param data {}
   */
  export const getLittleStreetList = ({commit, state, rootState, dispatch}, data) => {
    return base.getLittleStreetList(data)
      .then(response => {
        return response
      })
      .catch(() => {
        commit(globalTypes.SET_ERROR, 'message.default_tips')
      })
  }
  /**
   * 显示续费
   * @param data {}
   */
  export const getLicenceById = ({commit, state, rootState, dispatch}, data) => {
    return base.getLicenceById(data)
      .then(response => {
        return response
      })
      .catch(() => {
        commit(globalTypes.SET_ERROR, 'message.default_tips')
      })
  }
  /**
   * 确认续费
   * @param data {}
   */
  export const LicenceBalancePay = ({commit, state, rootState, dispatch}, data) => {
    return base.LicenceBalancePay(data)
      .then(response => {
        return response
      })
      .catch(() => {
        commit(globalTypes.SET_ERROR, 'message.default_tips')
      })
  }
  /**
   * 调整licence数量
   * @param data {}
   */
  export const updateRenewLicence = ({commit, state, rootState, dispatch}, data) => {
    return base.updateRenewLicence(data)
      .then(response => {
        return response
      })
      .catch(() => {
        commit(globalTypes.SET_ERROR, 'message.default_tips')
      })
  }
  /**
   * 
   * 调整licence数量
   * @param {*} data 
   */
  export const updateLicenceAndBalance = ({commit, state, rootState, dispatch}, data) => {
    return base.updateLicenceAndBalance(data)
      .then(response => {
        return response
      })
      .catch(() => {
        commit(globalTypes.SET_ERROR, 'message.default_tips')
      })
  }
  /**
   * 机器人服务
   * @param data {}
   */
  export const queryRobot = ({commit, state, rootState, dispatch}, data) => {
    return base.queryRobot(data)
      .then(response => {
        return response
      })
      .catch(() => {
        commit(globalTypes.SET_ERROR, 'message.default_tips')
      })
  }
  /**
   * 开通机器人
   * @param data {}
   */
  export const saveRobot = ({commit, state, rootState, dispatch}, data) => {
    return base.saveRobot(data)
      .then(response => {
        return response
      })
      .catch(() => {
        commit(globalTypes.SET_ERROR, 'message.default_tips')
      })
  }
  /**
   * 配置机器人
   * @param data {}
   */
  export const showRobotLoginUrl = ({commit, state, rootState, dispatch}, data) => {
    return base.showRobotLoginUrl(data)
      .then(response => {
        return response
      })
      .catch(() => {
        commit(globalTypes.SET_ERROR, 'message.default_tips')
      })
  }
  /**
   * 充值记录、消费记录、申请发票
   * @param data {}
   */
  export const redirectcenter = ({commit, state, rootState, dispatch}, data) => {
    return base.redirectcenter(data)
      .then(response => {
        return response
      })
      .catch(() => {
        commit(globalTypes.SET_ERROR, 'message.default_tips')
      })
  }
  /**
   * 银行支付完成
   * @param data {}
   */
  export const finishBankPay = ({commit, state, rootState, dispatch}, data) => {
    return base.finishBankPay(data)
      .then(response => {
        return response
      })
      .catch(() => {
        commit(globalTypes.SET_ERROR, 'message.default_tips')
      })
  }
  // ==============  充值按钮能否使用  计费配置
  export const queryPlatformAccount = ({commit, state, rootState, dispatch}, data) => {
    return base.queryPlatformAccount(data)
      .then(response => {
        return response
      })
      .catch(() => {
        commit(globalTypes.SET_ERROR, 'message.default_tips')
      })
  }
  // ==============
